@extends('admin.app')

@section('content')
  <div class="panel panel-default">
    <div class="panel-heading font-bold">
      管理员信息表单
    </div>
    <div class="panel-body">
      <form class="form-horizontal form-validation" action="{{ admin_action('Rbac\UsersController@update', [$user]) }}" method="post">
        {{ csrf_field() }}
        {{ method_field('PUT') }}
        <div class="form-group">
          <label class="col-lg-2 control-label">用户名*</label>
          <div class="col-lg-10">
            <input type="text" class="form-control" name="username" value="{{ $user->username }}" placeholder="请输入用户名" readonly=""> 
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <label class="col-lg-2 control-label">密码*</label>
          <div class="col-lg-10">
            <input type="password" class="form-control" id="password" name="password" placeholder="请输入密码" data-rule-required="true" data-rule-minlength="6">
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <label class="col-lg-2 control-label">确认密码*</label>
          <div class="col-lg-10">
            <input type="password" class="form-control" name="password_confirmation" placeholder="请输入确认密码" data-rule-required="true" data-rule-minlength="6" data-rule-equalto="#password">
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <label class="col-lg-2 control-label">拥有的角色*</label>
          <div class="col-lg-10">
            <select name="role[]" class="form-control select2" data-rule-required="true" multiple>
              @foreach($roles as $item)
              <option value="{{$item->id}}" {{in_array($item->id,$user_role)?'selected':''}}>{{$item->name}}--{{$item->slug}}</option>
              @endforeach
            </select>
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <div class="col-lg-4 col-lg-offset-2">
            <a href="{{ admin_action('Rbac\UsersController@index') }}" class="btn btn-default">返&nbsp;回</a>
            <button type="submit" class="btn btn-primary">保&nbsp;存</button>
          </div>
        </div>
      </form>
    </div>
  </div>
@endsection